/**
 * 本质上就是求 min{Sx + My + Lz}
 * 满足 6x+8y+12z >= N
 */
#include <bits/stdc++.h>
using namespace std;

#include <bits/extc++.h>

using llt = long long;
using vi = vector<int>;

int N, S, M, L;

int proc(){
    int ans = 2000000000;
    for(int i=0;i<=N/6+1;++i){
        for(int j=0;j<=N/8+1;++j){
            int total = i * 6 + j * 8;
            int left = N - total;
            int cost = i * S + j * M;
            if(left > 0){
                int k = left / 12;
                if(left % 12) k += 1;
                cost += L * k;
            }
            ans = min(ans, cost);
        }
    }
    return ans;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N >> S >> M >> L;
    cout << proc() << endl;
    return 0;
}